import java.awt.*; class MyFrame extends Frame { public MyFrame() { setLayout(new FlowLayout()); Button btn; btn=new Button("OK"); add(btn); } } class demo { public static void main(String args[]) { MyFrame frm=new MyFrame(); frm.setSize(200,200); frm.setVisible(true); } }
import java.awt.*; class MyFrame extends Frame { Button b1,b2; public MyFrame() { setLayout(new FlowLayout()); b1=new Button("RED"); b2=new Button("BLUE"); add(b1); add(b2); } } class demo { public static void main(String args[]) { MyFrame frm=new MyFrame(); frm.setSize(400,300); frm.setVisible(true); } }
import java.awt.*; class MyFrame extends Frame { public MyFrame() { setLayout(new FlowLayout()); Stringarr[]={"Monday","Tuesday","Wednesday","Thursday","Friday", "Saturday","Sunday"}; for(int i=0;i<arr.length;i++) { Button btn=new Button(arr[i]);add(btn); } } } class demo { public static void main(String args[]) { MyFrame frm=new MyFrame(); frm.setSize(400,400); frm.setVisible(true); } }